package descentFly.app.sight
{
	import UIFree.uif_component;
	
	import UIUtils.uif_utilBitmap;
	
	import descentFly.app.df_component;
	import descentFly.away3D4.df_loadSection;
	import descentFly.server.df_servers;
	
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.BlendMode;
	import flash.events.Event;
	
	public class df_bitmapSight extends df_component {
		private var _bitmap: Bitmap;
		private var _object: Object;
		public function df_bitmapSight(parent:uif_component, sightObject: Object) {
			super(parent);
			
			_object = sightObject;
			var ls: df_loadSection = new df_loadSection();
			_bitmap = ls.loadBmp(df_servers.SIGHTS_URL + sightObject.id + '.png', true);
			ls.endSection(doLoadComplete);
		}
		
		protected function doLoadComplete(): void {
			_bitmap.x = -_object.offset[0];
			_bitmap.y = -_object.offset[1];
			addChild(_bitmap);
		}
		
		override public function dispose():void {
			if (_bitmap.bitmapData) _bitmap.bitmapData.dispose();
			super.dispose();
		}
	}
}